<template>
    <div class="container">
        <!-- 条件 -->
        <div class="querydiv" shadow="never">
            <el-form  size="medium" label-width="100px">
                <el-row :span="24">
                    <el-col :span="5">
                        <el-form-item label="当前分支名称">
                            <el-input  v-model="inForm.branchName" placeholder="当前分支名称"></el-input>
                        </el-form-item>
                        <el-form-item label="当前分支编号">
                            <el-input  v-model="inForm.branchCode" placeholder="当前分支编号"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="4" class="disflex spacecenter align-center" style="height:90px">
                        <el-image fit="cover" style="width:130px;height:34px" :src="require('@/assets/arrow.png')" />
                    </el-col>
                    <el-col :span="5">
                        <el-form-item label="合并分支名称">
                            <el-input  v-model="inForm.toBranchName" placeholder="合并分支名称"></el-input>
                        </el-form-item>
                        <el-form-item label="合并分支编号">
                            <el-input  v-model="inForm.toBranchCode" placeholder="合并分支编号"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="10">
                        <el-form-item label="合并备注" class="pdleft20">
                            <el-input  v-model="inForm.toRemarks" :autosize="{ minRows: 4, maxRows: 4}" type="textarea" placeholder="合并备注"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
        </div>
        <!-- 内容 -->
        <el-row :gutter="20">
            <el-col :span="6" class="mt15" v-for="(item,index) in this.inForm.workList" :key="index">
                <el-card class="box-card">
                    <div slot="header" class="spacebetween disflex align-center">
                        <span style="color:#000;font-size:16px;font-weight:700">{{item.title}}</span>
                    </div>
                    <div class="itemlist" @click="handletoEMinfo(item)">
                        <p class="ps">编码：<span>{{item.num}}</span></p>
                        <p class="ps">更新时间：<span>{{item.updateTime}}</span></p>
                        <p>状态：<el-tag type="success" size="small">{{item.status=='Y'?'有调整':'无调整'}}</el-tag></p>
                    </div>
                    <!-- <el-progress :percentage="50"></el-progress> -->
                </el-card>
            </el-col>
        </el-row>
        <!-- 列表 -->
        <div class="mt15">
            <el-card class="box-card">
                <div slot="header" class="spacebetween disflex align-center">
                    <span style="color:#000;font-size:16px;font-weight:700">说明文档</span>
                </div>
                <el-table :data="fileList" :header-cell-style="{background:'#e4ebfd',color:'#7690db'}">
                    <el-table-column align="center" prop="filename"  label="附件名称" ></el-table-column>
                    <el-table-column align="center" prop="originalName"  label="源文件名称" ></el-table-column>
                    <el-table-column align="center" prop="type"  label="类型" ></el-table-column>
                    <el-table-column align="center" prop="size"  label="大小" ></el-table-column>
                    <el-table-column align="center" fixed="right"  label="操作">
                        <template slot-scope="scope">
                            <el-button type="text"  class="edit" @click="handlInfo(scope.row)">查看</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div class="mt15 disflex pd-x20 spacecenter">
                    <el-button type="primary" class="btn btncolor" size="medium" @click="submitmerges('Y')">通过合并</el-button>
                    <el-button  @click="submitmerges('N')">驳回关闭</el-button>
                    <el-button  >取消</el-button>
                </div>
            </el-card>
        </div>
    </div>
</template>

<script>
import { mergewdetail,branchlist,submitmerge } from '@/api/manager.js'
export default {
    data(){
        return{
            inForm:{},
            tableData:[],
            id:this.$route.query.id,
            inForm:{},
            fileform:{
                page:1,
                num:10,
                id:''
            },
            fileList:[]
        }
    },
    created(){
        this.getInfo()
        this.getfileList()
    },
    methods:{
        getInfo(){
            this.$getFlag().then(obj=>{
                mergewdetail({id:this.id},obj.data).then(res=>{
                    if(res.status==200){
                        this.inForm = res.data
                        // this.tableData = res.data.workList
                    }
                })
            })
        },
        getfileList(){
            this.fileform.id = this.id
            this.$getFlag().then(obj=>{
                branchlist(this.fileform,obj.data).then(res=>{
                    if(res.status == 200){
                        this.fileList = res.list
                    }
                })
            })
        },
        handletoEMinfo(item){
            this.$router.push({
                path: '/iteminfo',
                query:{id:this.id,changeFlag:item.checkStatus,action:item.action}
            })
        },
        submitmerges(type){
            let data = {
                id:this.id,
                result:type,
                remarks:this.inForm.toRemarks
            }
            this.$getFlag().then(obj=>{
                submitmerge(data,obj.data).then(res=>{
                    if(res.status == 200){
                        this.$notify({  title: "操作成功", message: res.msg, type: "success",duration: 2000,});
                    }else{
                        this.$notify({ title: "操作失败",message: res.error, type: "error", duration: 2000,});
                    }
                })
            })
        },
        handlInfo(){

        }
    }
}
</script>
<style scoped lang="scss">
    .itemlist{
        .ps{
            font-size:14px;
            color:#999;
            span{
                color:#111;
                font-size:14px;
            }
        }
    }
</style>